<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Dog(name, color) {
            this.name = name;
            this.color = color;
            this.seeDoor = function () {
                console.log(this.name + '坐在门前看门');
            }
            this.eat = function () {
                console.log('吃食');
            }
        }
        let wc = new Dog('旺财', '黑色');
        let lf = new Dog('来福', '白色');
        wc.eat();
        wc.seeDoor();



    </script>
</body>

</html>